%define commit 992eecbf1677eae9ce5c920fbb2d3d824bb104b1
%define commit_short %(echo %{commit} | head -c6)

Summary(ru_RU.UTF-8):	Иконки для дистрибутивов МОС
Summary: 	Icons for MOS distros
Name:		mos-icons
License:	CC-BY-SA-3.0 and GPL-3.0
Group:		Graphics
Version:	5
Release:	3.git%{commit_short}.1
Url:		https://hub.mos.ru/mos/src/mos-icons
Vendor:		MOS
Source0:	https://hub.mos.ru/mos/src/mos-icons/-/archive/%{commit}/%{name}-%{commit}.tar.gz
BuildArch:	noarch
BuildRequires:	sed

%description
Icons for MOS distros
%description -l ru_RU.UTF-8
Иконки для дистрибутивов МОС

#---------------------------------------------------------

%package core-classic
Summary: Core icons of MOS, classic variant
Summary(ru): Основные иконки МОС, классический вариант
License: CC-BY-SA-3.0
Group: Graphics

%description core-classic
Core icons of MOS, classic variant
%description core-classic -l ru_RU.UTF-8
Основные иконки МОС, классический вариант

%files core-classic
%license COPYING
%{_iconsdir}/hicolor/*x*/apps/*.png
%{_iconsdir}/hicolor/*x*/apps/*.svg
%{_iconsdir}/hicolor/scalable/apps/*.svg

#---------------------------------------------------------

%package theme-classic
Summary: MOS icon themes, classic variant
Summary(ru): Темы иконок МОС, классический вариант
License: GPL-3.0
Group: Graphics
Requires: %{name}-core-classic = %{EVRD}
Requires: breeze-icon-theme
Requires: breeze-icon-theme-dark

%description theme-classic
Light and dark MOS icon themes. Inherit Breeze and
replace some icons.
%description theme-classic -l ru_RU.UTF-8
Светлая и темные темы значков для МОС. Наследуют
тему Breeze, заменяя некоторые иконки.

%files theme-classic
%license COPYING
%{_iconsdir}/mos-classic-light
%{_iconsdir}/mos-classic-dark

#---------------------------------------------------------

%prep
%autosetup -p1 -n %{name}-%{commit}

%build

%install

# core
mkdir -p %{buildroot}%{_iconsdir}/hicolor
cp -rv icons-mos-classic/* %{buildroot}%{_iconsdir}/hicolor
# ensure correct modes
find %{buildroot}%{_iconsdir} -type f | xargs chmod 0644
find %{buildroot}%{_iconsdir} -type d | xargs chmod 0755

# themes
mkdir -p %{buildroot}%{_iconsdir}/mos-classic-light
mkdir -p %{buildroot}%{_iconsdir}/mos-classic-dark
sed icon-theme-mos-classic/index.theme -e '/^@dark /d' -e 's/^@light //' > %{buildroot}%{_iconsdir}/mos-classic-light/index.theme
sed icon-theme-mos-classic/index.theme -e '/^@light /d' -e 's/^@dark //' > %{buildroot}%{_iconsdir}/mos-classic-dark/index.theme
